#!/bin/sh

repo=$1
url=$2

if [ ! -d "$repo" ]; then
  mkdir -p "$repo"
fi

cd "$repo"

curl -LO -s  "$url"

v=$(rpm -qpi *.rpm | grep Epoch | awk {'print $3'})

i=$?

cd .. && rm -rf "$repo"

if [ "$i" != 0 ]; then
exit 1
fi

echo "$v"